<?php
	class indexController extends Controller
	{
		public function index()
		{

			if($this->registry->auth->isLoggedin())
			{
				$this->registry->template->welcome = 'Welkom in het admin panneel.';
				$this->registry->template->login = "Welkom.";
			}
			else
			{
				$this->registry->template->welcome = 'U wordt vriendelijk verzocht om in te loggen.<pre>'.print_r($this, true).'</pre>';
				$this->registry->template->login = '<form action="index/login" method="post" accept-charset="utf-8">
														<table>
															<tr>
																<td>gebruikersnaam:</td>
																<td><input type="text" name="username" value=""></td>
															</tr>
															<tr>
																<td>wachtwoord:</td>
																<td><input type="password" name="username" value=""></td>
															</tr>
															<tr>
																<td></td>
																<td><input type="submit" name="" value="log in"></td>
															</tr>
														</table>
													</form>';
			}

			$this->registry->template->menu = '<ul><li><a href="#">test</a></li></ul>';

			$this->registry->template->show('index', array('header', CONTROLLER, 'footer'), '/admin');
		}
		public function login()
		{
			if(isset($_POST['username']) && isset($_POST['password']))
			{
				if($this->registry->auth->login($_POST['username'], $_POST['password']))
				{
					$this->registry->template->status = "U bent ingelogd.";
				}
				else
				{
					$this->registry->template->status = "Onjuiste gebruikersnaam of wachtwoord.";
				}
				$this->registry->template->status = "U heeft niet genoeg gegevens ingevuld.";
			}
			
		}
	}
?>